;;64 bit version.
;;assemble with >  nasm -fwin64 hello.asm
;; link with >  gcc -m64 -mconsole hello.obj -o hello.exe
;; rm *.lst *.o *.obj *.exe
global  main
    extern  printf

    section .text
main:
;---------
    push rbp
    mov rbp, rsp
    ;; reserve for local variables
    ;; 2 qwords for argc and argv
    ;; and 1 qword for return value
    ;; 1 more qword to align with 16 bits
    sub rsp, 8*4   

    mov rcx,   message
    call    printf
   
    mov rax,0
    add rsp,8*4    ;; deallocate local variables
    pop rbp
    ret
;---------
message:
    db  'Hello, World', 13, 10, 0